/*
Arm Tracker and Glove Demo by Noah Zerkin (noazark AT gmail.com) 2009
Released under GNU GPLv3.0 http://www.opensource.org/licenses/gpl-3.0.html
*/

void thumbStick(int s){
  int thumbPos = 0;
  joyX = 0; 
  joyY = 0;
  if (thumb[s][9] >= 173 && fingerIndex[s][1] <= 200){
    thumbPos += 1;
  }
  if (thumb[s][9] <= 177 && thumb[s][11] <= 190 && fingerIndex[s][1] >= 200){
    thumbPos += 2;  
  }
  if (thumb[s][10] >= 149){
    thumbPos += 5;  
  }
  if (thumb[s][10] < 140){
    thumbPos += 9;
  }  

  switch(thumbPos){
  case 0:
    break;

  case 1:
    joyY = -30;
    break;

  case 2:
    joyY = 30;
    break;

  case 5:
    joyX = 30;
    break;

  case 6:
    joyX = 30; 
    joyY = -30;
    break;

  case 7:
    joyX = 30; 
    joyY = 30;
    break;

  case 9:
    joyX = -30;
    break;

  case 10:
    joyX = -30; 
    joyY = -30;
    break;

  case 11:
    joyX = -30; 
    joyY = 30;
    break;
  default:
    break;
  }
  if(gloveY[s] >= 510){
    zoom -= 3;
  }
  if(gloveY[s] <= 480){
    zoom += 3;
  }
}
